package number;

/**
 * Created by fengliejv on 2017/10/15.
 */
public class ExcelSheetColumnNumber171 {

    public int titleToNumber(String s) {
        int m = 1;
        int result = 0;
        for (int i = s.length() - 1; i >= 0; i--) {
            result += (s.charAt(i) - 'A' + 1) * m;
            m = m * 26;
        }

        return result;
    }
}
